package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.TicketPayOrderForm;
import cn.wolfcode.trip.base.mapper.TicketPayOrderFormMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ITicketPayOrderFormService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TicketPayOrderFormServiceImpl implements ITicketPayOrderFormService {
    @Autowired
    private TicketPayOrderFormMapper ticketPayOrderFormMapper;


    @Override
    public void save(TicketPayOrderForm ticketPayOrderForm) {
        ticketPayOrderFormMapper.insert(ticketPayOrderForm);
    }

    @Override
    public void delete(Long id) {
        ticketPayOrderFormMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<TicketPayOrderForm> selectAll() {
        return ticketPayOrderFormMapper.selectAll();
    }

    @Override
    public void update(TicketPayOrderForm ticketPayOrderForm) {
        ticketPayOrderFormMapper.updateByPrimaryKey(ticketPayOrderForm);
    }

    @Override
    public TicketPayOrderForm get(Long id) {
        return ticketPayOrderFormMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<TicketPayOrderForm> list = ticketPayOrderFormMapper.queryForList(qo);
        return new PageInfo(list);
    }
}
